/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.dengues.model.database.util;

import java.util.List;

import org.dengues.model.database.*;

import org.dengues.model.warehouse.Storage;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see org.dengues.model.database.DatabasePackage
 * @generated
 */
public class DatabaseSwitch<T> {
    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public static final String copyright = "// ============================================================================\r\n//\r\n// Copyright (C) 2006-2007 Dengues\r\n//\r\n// Google Group: http://groups.google.com/group/dengues\r\n// QQ Group: 24885404\r\n//\r\n// This library is free software; you can redistribute it and/or\r\n// modify it under the terms of the GNU Lesser General Public\r\n// License as published by the Free Software Foundation; either\r\n// version 2.1 of the License.\r\n//\r\n// This library is distributed in the hope that it will be useful,\r\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r\n// Lesser General Public License for more details.\r\n//\r\n// You should have received a copy of the GNU General Public License\r\n// along with this program; if not, write to the Free Software\r\n// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r\n//\r\n// ============================================================================\r\n";
    /**
     * The cached model package
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected static DatabasePackage modelPackage;

    /**
     * Creates an instance of the switch.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public DatabaseSwitch() {
        if (modelPackage == null) {
            modelPackage = DatabasePackage.eINSTANCE;
        }
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    public T doSwitch(EObject theEObject) {
        return doSwitch(theEObject.eClass(), theEObject);
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    protected T doSwitch(EClass theEClass, EObject theEObject) {
        if (theEClass.eContainer() == modelPackage) {
            return doSwitch(theEClass.getClassifierID(), theEObject);
        }
        else {
            List<EClass> eSuperTypes = theEClass.getESuperTypes();
            return
                eSuperTypes.isEmpty() ?
                    defaultCase(theEObject) :
                    doSwitch(eSuperTypes.get(0), theEObject);
        }
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    protected T doSwitch(int classifierID, EObject theEObject) {
        switch (classifierID) {
            case DatabasePackage.DB_TABLE: {
                DBTable dbTable = (DBTable)theEObject;
                T result = caseDBTable(dbTable);
                if (result == null) result = caseDiagramChild(dbTable);
                if (result == null) result = caseAbstractDBObject(dbTable);
                if (result == null) result = caseStorage(dbTable);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.DB_COLUMN: {
                DBColumn dbColumn = (DBColumn)theEObject;
                T result = caseDBColumn(dbColumn);
                if (result == null) result = caseDiagramChild(dbColumn);
                if (result == null) result = caseAbstractDBObject(dbColumn);
                if (result == null) result = caseStorage(dbColumn);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.DATABASE_DIAGRAM: {
                DatabaseDiagram databaseDiagram = (DatabaseDiagram)theEObject;
                T result = caseDatabaseDiagram(databaseDiagram);
                if (result == null) result = caseAbstractDBObject(databaseDiagram);
                if (result == null) result = caseStorage(databaseDiagram);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.FOREIGN_KEY: {
                ForeignKey foreignKey = (ForeignKey)theEObject;
                T result = caseForeignKey(foreignKey);
                if (result == null) result = caseAbstractDBObject(foreignKey);
                if (result == null) result = caseStorage(foreignKey);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.DB_NOTE: {
                DBNote dbNote = (DBNote)theEObject;
                T result = caseDBNote(dbNote);
                if (result == null) result = caseDiagramChild(dbNote);
                if (result == null) result = caseAbstractDBObject(dbNote);
                if (result == null) result = caseStorage(dbNote);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.DIAGRAM_CHILD: {
                DiagramChild diagramChild = (DiagramChild)theEObject;
                T result = caseDiagramChild(diagramChild);
                if (result == null) result = caseAbstractDBObject(diagramChild);
                if (result == null) result = caseStorage(diagramChild);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.ABSTRACT_DB_OBJECT: {
                AbstractDBObject abstractDBObject = (AbstractDBObject)theEObject;
                T result = caseAbstractDBObject(abstractDBObject);
                if (result == null) result = caseStorage(abstractDBObject);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_COLUMNS: {
                SectionColumns sectionColumns = (SectionColumns)theEObject;
                T result = caseSectionColumns(sectionColumns);
                if (result == null) result = caseAbstractDBObject(sectionColumns);
                if (result == null) result = caseStorage(sectionColumns);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_FILTERS: {
                SectionFilters sectionFilters = (SectionFilters)theEObject;
                T result = caseSectionFilters(sectionFilters);
                if (result == null) result = caseAbstractDBObject(sectionFilters);
                if (result == null) result = caseStorage(sectionFilters);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_GROUPS: {
                SectionGroups sectionGroups = (SectionGroups)theEObject;
                T result = caseSectionGroups(sectionGroups);
                if (result == null) result = caseAbstractDBObject(sectionGroups);
                if (result == null) result = caseStorage(sectionGroups);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_SORTS: {
                SectionSorts sectionSorts = (SectionSorts)theEObject;
                T result = caseSectionSorts(sectionSorts);
                if (result == null) result = caseAbstractDBObject(sectionSorts);
                if (result == null) result = caseStorage(sectionSorts);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_HAVINGS: {
                SectionHavings sectionHavings = (SectionHavings)theEObject;
                T result = caseSectionHavings(sectionHavings);
                if (result == null) result = caseAbstractDBObject(sectionHavings);
                if (result == null) result = caseStorage(sectionHavings);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_UNIONS: {
                SectionUnions sectionUnions = (SectionUnions)theEObject;
                T result = caseSectionUnions(sectionUnions);
                if (result == null) result = caseAbstractDBObject(sectionUnions);
                if (result == null) result = caseStorage(sectionUnions);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.FOREIGN_KEY_LABEL: {
                ForeignKeyLabel foreignKeyLabel = (ForeignKeyLabel)theEObject;
                T result = caseForeignKeyLabel(foreignKeyLabel);
                if (result == null) result = caseDiagramChild(foreignKeyLabel);
                if (result == null) result = caseAbstractDBObject(foreignKeyLabel);
                if (result == null) result = caseStorage(foreignKeyLabel);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.FK_BENDPOINT: {
                FKBendpoint fkBendpoint = (FKBendpoint)theEObject;
                T result = caseFKBendpoint(fkBendpoint);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.META_XML_DIAGRAM: {
                MetaXMLDiagram metaXMLDiagram = (MetaXMLDiagram)theEObject;
                T result = caseMetaXMLDiagram(metaXMLDiagram);
                if (result == null) result = caseDatabaseDiagram(metaXMLDiagram);
                if (result == null) result = caseAbstractDBObject(metaXMLDiagram);
                if (result == null) result = caseStorage(metaXMLDiagram);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            default: return defaultCase(theEObject);
        }
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>DB Table</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>DB Table</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseDBTable(DBTable object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>DB Column</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>DB Column</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseDBColumn(DBColumn object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Diagram</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Diagram</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseDatabaseDiagram(DatabaseDiagram object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Foreign Key</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Foreign Key</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseForeignKey(ForeignKey object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>DB Note</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>DB Note</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseDBNote(DBNote object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Diagram Child</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Diagram Child</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseDiagramChild(DiagramChild object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Abstract DB Object</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Abstract DB Object</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseAbstractDBObject(AbstractDBObject object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Columns</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Columns</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseSectionColumns(SectionColumns object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Filters</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Filters</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseSectionFilters(SectionFilters object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Groups</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Groups</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseSectionGroups(SectionGroups object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Sorts</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Sorts</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseSectionSorts(SectionSorts object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Havings</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Havings</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseSectionHavings(SectionHavings object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Unions</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Unions</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseSectionUnions(SectionUnions object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Foreign Key Label</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Foreign Key Label</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseForeignKeyLabel(ForeignKeyLabel object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>FK Bendpoint</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>FK Bendpoint</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseFKBendpoint(FKBendpoint object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Meta XML Diagram</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Meta XML Diagram</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseMetaXMLDiagram(MetaXMLDiagram object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Storage</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Storage</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseStorage(Storage object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch, but this is the last case anyway.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject)
     * @generated
     */
    public T defaultCase(EObject object) {
        return null;
    }

} //DatabaseSwitch
